package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                                                                                                                                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustomerXdsReportMapper;
import com.ruoyi.bizsys.domain.CustomerXdsReport;
import com.ruoyi.bizsys.service.ICustomerXdsReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 用户XDS征信Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class CustomerXdsReportServiceImpl extends ServiceImpl<CustomerXdsReportMapper,CustomerXdsReport> implements ICustomerXdsReportService {

    /**
     * 查询用户XDS征信
     *
     * @param id 用户XDS征信ID
     * @return 用户XDS征信
     */
    @Override
    public CustomerXdsReport selectCustomerXdsReportById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询用户XDS征信列表
     *
     * @param customerXdsReport 用户XDS征信
     * @return 用户XDS征信
     */
    @Override
    public List<CustomerXdsReport> selectCustomerXdsReportList(CustomerXdsReport customerXdsReport) {
        return this.list(new QueryWrapper<>(customerXdsReport).last("order by id desc"));
    }

    /**
     * 新增用户XDS征信
     *
     * @param customerXdsReport 用户XDS征信
     * @return 结果
     */
            @Override
    public int insertCustomerXdsReport(CustomerXdsReport customerXdsReport) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        customerXdsReport.setCreateTime(DateUtils.getNowDate());
                            return baseMapper.insert(customerXdsReport);
    }

    /**
     * 修改用户XDS征信
     *
     * @param customerXdsReport 用户XDS征信
     * @return 结果
     */
            @Override
    public int updateCustomerXdsReport(CustomerXdsReport customerXdsReport) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                customerXdsReport.setUpdateTime(DateUtils.getNowDate());
                                                                    return baseMapper.updateById(customerXdsReport);
    }

    /**
     * 批量删除用户XDS征信
     *
     * @param ids 需要删除的用户XDS征信ID
     * @return 结果
     */
            @Override
    public int deleteCustomerXdsReportByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户XDS征信信息
     *
     * @param id 用户XDS征信ID
     * @return 结果
     */
    @Override
    public int deleteCustomerXdsReportById(Long id) {
        return baseMapper.deleteById(id);
    }

}
